#ifndef STACKADAPTOR_H
#define STACKADAPTOR_H

#include "constante.h"
/*#include "integer.h"
#include "real.h"
#include "fraction.h"*/
#include <vector>
#include <sstream>
using namespace std;
class StackAdaptor
{
    vector<Constante*> myStack;
public:
    StackAdaptor();
    string print(int n)const;
    void clear(){
        myStack.clear();
    }
    void swap(int x,int y){
        Constante*tmp = myStack[x];
        myStack[x] = myStack[y];
        myStack[y] = tmp;
    }
 /*   void dup(){
        Constante*tmp;
        switch(myStack.back()->getType()){
        case Constante::INTEGER:
                tmp = new Integer(static_cast<Integer&>(*tmp));
        break;
        case Constante::RATIONNAL:
                tmp = new Fraction(static_cast<Fraction&>(*tmp));
        break;
        case Constante::REAL:
                tmp = new Real(static_cast<Real&>(*tmp));
        break;

        }
        myStack.push_back(tmp);

    }*/
    void drop(){
        myStack.pop_back();
    }
    void add(Constante* c){
        myStack.push_back(c);
    }
    Constante* top()const{
        return myStack.back();
    }
    Constante* sum()const;
    Constante* mean()const;

};

#endif // STACKADAPTOR_H
